ImageGear Professional for Linux
Detecting Image File Format

You can detect the format of an image file before and after loading it in the HIGEAR handle using functions IG_fltr_detect_...():

All three functions return the type of image format as IG_FORMAT_ constant, as delineated in the accucnst.h file.

The code fragment below allows you to sort image files by their formats and then choose how to use them:

 
Copy Code
AT_ERRCOUNT nErrCount = IGE_SUCCESS;/* will hold returned error count */
AT_MODE nFormatID;
...
nErrCount = IG_fltr_detect_file( "image.tiff", &nFormatID );
if( nFormatID==IG_FORMAT_TIF )
{
...
}

For better performance or for some other purposes, use the special functions IG_fltr_load_file_format() and IG_fltr_pagecount_file_format() if the image format is known. Those functions accept the first parameter as the format ID and do not perform detect operations like IG_fltr_load_file() does, but immediately start to operate with the data, assuming it from the specified format. If the data is invalid or the image format is different, then an error is placed in the error stack.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback